# ARGS
if {[set projectName [lindex $argv 0]] == {}} {
    ::contrib::log::info "Sorry, tank need project name.\nExample: tank new helloWorld"
    exit
}

# CREATE PROJECT
proc createProject {name} {
    file mkdir $name; cd $name
    foreach d {src lib test} {file mkdir $d}
    withOpen fh [open project.tcl w] {
        puts $fh "#PROJECT:$name\nset version 0.1\nset description \"\"\nset dependencies \[list \]\nset main main.tcl"
    }
    withOpen fh [open src/main.tcl w] {
        puts $fh "# IMPORT \n\n# ARGS\n\n# MAIN\n\n# RUN\nif {\$argv0 == \[info script\]} {\n\n}"
    }
    withOpen fh [open test/main.tcl w] {
        puts $fh "# IMPORT\n\n# ARGS\n\n# TEST\nnamespace eval test[string toupper $name 0] {\n\n}"
    }
}

createProject $projectName